package powers;

import Items.Weapon;
import abilities.Ability;

/**
 * calculating hits.
 * 
 * @author bjo013
 * 
 */
public class Hit
{
	int W;
	Ability fromAbility;

	/**
	 * Counstructor for Hit
	 * 
	 * @param W
	 *            number of times the weapondamage.
	 * @param fromAbility
	 *            which ability to use
	 */
	public Hit(int W, Ability fromAbility)
	{
		this.W = W;
		this.fromAbility = fromAbility;
	}

	/**
	 * roll the hit
	 * 
	 * @param weapon
	 *            the weapon that is used
	 * @param modifier
	 *            any modifier to the roll
	 * @return damage done
	 */
	public int roll(Weapon weapon, int modifier)
	{
		return weapon.getDie().rollTimes(weapon.getNbDice() * W) + modifier;
	}

	/**
	 * the ability that is used
	 * 
	 * @return ability used in the damage roll
	 */
	public Ability getAbility()
	{
		return fromAbility;
	}

	@Override
	public String toString()
	{
		return W + "[W]" + " + " + fromAbility + " mod";
	}
}
